package com.hogocloud.myframe.data

import com.hogocloud.corelibrary.base.BaseRepository
import com.hogocloud.corelibrary.base.IView
import com.hogocloud.corelibrary.http.BaseException
import com.hogocloud.corelibrary.http.RequestMultiplyCallback
import com.hogocloud.myframe.data.bean.HomeDataBean

/**
 * class
 *
 * @author gjc
 * @version 1.0.0
 * @since 2019-08-06
 */
class HomeRepository(baseViewModelEvent: IView) : BaseRepository(baseViewModelEvent) {

    companion object {
        @Volatile
        private var INSTANCE: HomeRepository? = null

        fun getInstance(baseViewModelEvent: IView) =
            INSTANCE ?: synchronized(this) {
                INSTANCE ?: HomeRepository(baseViewModelEvent).also { it }
            }
    }

    private val mHomeService = create(IApi::class.java)

    fun getHomeData() {
        execute(mHomeService.getHomeData(), object : RequestMultiplyCallback<HomeDataBean>{
            override fun onSuccess(data: HomeDataBean) {

            }

            override fun onFail(exception: BaseException) {

            }
        })
    }
}